import { ReactNode } from "react";
import { Navigate } from "react-router-dom";
import { useSelector } from "react-redux";
import { RootState } from "@/store";
type Props = {
  children: ReactNode;
};

export default function RquireAuth(props: Props) {
  let user = useSelector((state: RootState) => state.user);
  console.log("状态机数据", user);

  return <div>{user.userInfo ? props.children : <Navigate to="/login" />}</div>;
}
